package com.bigdata.bookinfo.job;

import com.bigdata.bookinfo.Utils.MyUtil;
import com.bigdata.bookinfo.mapper.CommentMaxMapper;
import com.bigdata.bookinfo.pojo.KeyAndScore;
import com.bigdata.bookinfo.reduce.CommentMaxReduce;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;

public class JobMain1 extends Configured implements Tool {

//    评论前十
    public static void main(String[] args) throws Exception {
        Configuration configuration = new Configuration();
        ToolRunner.run(configuration, new JobMain1(), args);
    }

    @Override
    public int run(String[] strings) throws Exception {
        Job job = Job.getInstance(super.getConf(), "mapreduce_book");
        String inputPath = "hdfs://127.0.0.1:9000/user/data/out/part-r-00000";
        String outputPath = "hdfs://127.0.0.1:9000/user/out/out1";
        return MyUtil.run(job, inputPath,outputPath, CommentMaxMapper.class, KeyAndScore.class, CommentMaxReduce.class);
    }
}
